package cn.messageplus.core.test.server.config;

import cn.messageplus.core.entity.ChatRoom;
import cn.messageplus.core.entity.Group;
import cn.messageplus.core.implement.SelectChatRoomInterface;
import cn.messageplus.core.implement.SelectGroupInterface;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@Configuration
public class MpcConfig {
    @Bean
    public SelectGroupInterface selectGroupInterface() {
        return () -> {
            List<Group> groupList = new ArrayList<>();

            CopyOnWriteArrayList<String> ids = new CopyOnWriteArrayList<>();
            ids.add("lisi");
            Group group1 = new Group("1", "admin", "相亲相爱一家人", ids);

            groupList.add(group1);
            return groupList;
        };
    }
    @Bean
    public SelectChatRoomInterface selectChatRoomInterface() {
        return () -> {
            List<ChatRoom> chatRoomList = new ArrayList<>();

            ChatRoom chatRoom = new ChatRoom("1", "admin", "家人们直播间");

            chatRoomList.add(chatRoom);
            return chatRoomList;
        };
    }
}
